Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Ability to write migration custom logic in Go #187

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

vasayxtx
Copy link

Sometimes it's needed to write custom logic (usually for data migration, not scheme) in Go during migration. Please consider this change.

@vasayxtx
Copy link
Author

@rubenv could you please review?

@rubenv
Copy link
Owner

rubenv commented Jan 21, 2021

So one reason I never added this was because it basically brakes CLI usage. Not sure what to do with this.

@vasayxtx
Copy link
Author

vasayxtx commented Jan 24, 2021

So one reason I never added this was because it basically brakes CLI usage. Not sure what to do with this.

Writing migrations in Go (FuncUp/FuncDown) will be available using only MemoryMigrationSource. In this case, sql-migrate is always used as a library, not a CLI standalone tool.

For me, it's okay if the library will provide advanced functionality that is needed for projects in which the migration logic cannot be implemented in just SQL. The choice of how to write and run migrations will be up to the developer. I don't see any real problem here.

Please correct me if I'm wrong, miss something, or misunderstood your comment.

@vasayxtx
Copy link
Author

vasayxtx commented Feb 2, 2021

@rubenv could you please clarify if there is a chance to continue the discussion? Or is it your final decision and fork is the only way for us?

@rubenv
Copy link
Owner

rubenv commented Feb 2, 2021 via email

@vasayxtx
Copy link
Author

vasayxtx commented Feb 2, 2021

No problem, this is a very important and good event! Сongratulations!:)

Comment on lines +8 to -10
"github.com/go-gorp/gorp/v3"
"github.com/gobuffalo/packr/v2"
_ "github.com/mattn/go-sqlite3"
. "gopkg.in/check.v1"
"gopkg.in/gorp.v1"
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure we can do this. Sadly gorp ended up as part of the public API and I guess this will break things for people that depend on it?

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mind you, we should probably upgrade, but I don't want to break peoples code if we can avoid it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants